package xiangMu.car;

import java.util.Scanner;

public class RentalCarsTest {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        RentalCars rentalCars = new RentalCars("金路至尊租赁有限公司", "合肥市瑶海区明光路160号", "999999999");
        int choice = 0;
        System.out.println(rentalCars);
        while (true) {
            System.out.println("本公司现有" + rentalCars.getsumAuto() + "辆车可租");
            System.out.println("1:查看车辆情况，2:租赁，3:还车，4:报废，5:采购新车，6:查看租赁记录，9:退出");
            System.out.print("请选择:");
            choice = input.nextInt();
            if (choice == 1) {
                System.out.println("--查看车辆情况--");
                System.out.print("输入数字，选择要查看车辆的类型(1.轿车/2.客车):");
                int a;
                while (!((a = input.nextInt()) == 1 || a == 2))
                    System.out.print("数字错误，请重新输入:");
                rentalCars.show(a);
            } else if (choice == 2) {
                System.out.println("--租赁--");
                rentalCars.rentAuto();
            } else if (choice == 3) {
                System.out.println("--还车--");
                rentalCars.returnAuto();
            } else if (choice == 4) {
                System.out.println("--报废--");
                rentalCars.delAuto();
            } else if (choice == 5) {
                System.out.println("--采购新车--");
                rentalCars.addAuto();
            } else if (choice == 6) {
                System.out.println("--查看租赁记录--");
                rentalCars.getAutoRecord();
            } else if (choice == 9) {
                System.out.println("--退出--");
                break;
            } else {
                System.out.println("输入错误，请重新输入");
                continue;
            }
        }

    }
}
